/**
 * 
 */
package fr.utbm.gi.vi51.slizers.pw.agent;

import org.janusproject.kernel.address.AgentAddress;

import fr.utbm.gi.vi51.slizers.framework.agent.AgentBody;

/**
 * Implementation of a creature's body.
 *
 * @author Tarik Belabbas
 *
 */
public class CreatureBody extends AgentBody
{

	/**
	 * The number of worlds cells traveled since the beginning of the fall.
	 */
	private int fallingDistance;

	/**
	 * The state of the creature body.
	 */
	private CreatureBodyState state;
	
	/**
	 * Parameterized constructor.
	 * 
	 * @param _owner the address of the owner
	 */
	public CreatureBody( AgentAddress _owner )
	{
		super( _owner );
		this.fallingDistance = 0;
		this.state = CreatureBodyState.FALLING;
	}

	/**
	 * Returns the falling distance.
	 * 
	 * @return the falling distance
	 */
	public int getFallingDistance()
	{
		return this.fallingDistance;
	}

	/**
	 * Increments the falling distance.
	 */
	public void incrementFallingDistance()
	{
		this.fallingDistance++;
	}

	/**
	 * Resets the falling distance.
	 */
	public void resetFallingDistance()
	{
		this.fallingDistance = 0;
	}
	
	/**
	 * Returns the state of the creature body.
	 * 
	 * @return the state of the creature body
	 */
	public CreatureBodyState getState()
	{
		return this.state;
	}

	/**
	 * Sets the state of the creature body.
	 * 
	 * @param _state the new state of the creature body
	 */
	public void setState( CreatureBodyState _state )
	{
		this.state = _state;
	}
}
